<div class="row wrapper white-bg page-heading">
  <div class="container-fluid">
    <h2>商品列表</h2>
  </div>
  <div class="container-fluid">
    <div class="col-md-2 pull-right" style="text-align: right">
      <button class="btn btn-primary" ui-sref="home.commodity.commodityAdd"><i class="fa fa-plus-circle"></i> 新增商品</button>
    </div>
  </div>
  <br>
  <div class="container-fluid">
    <table class="table table-hover">
      <thead>
      <tr>
        <th>商品名称</th>
        <th>缩略图</th>
        <th>原价</th>
        <th>现价</th>
        <th>商品类型</th>
        <th>是否推荐</th>
        <th>是否代售</th>
        <th>创建时间</th>
        <th>操作</th>
      </tr>
      </thead>
      <tfoot></tfoot>
      <tbody>
      <tr ng-repeat="item in commodityListCtrl.commodityList">
        <td style="max-width:300px;min-width:10px;">{{item.caption}}</td>
        <td><img style="height:50px;" src="{{item.bgPicture}}" alt=""></td>
        <td>{{item.originalPrice}}</td>
        <td>{{item.nowPrice}}</td>
        <td>{{item.type}}</td>
        <td style="color:#ec4758;font-weight: bold;" ng-if="item.recommend ==1">推荐</td>
        <td ng-if="item.recommend !=1">未推荐</td>
        <td ng-if="item.userId">是</td>
       	<td ng-if="!item.userId">否</td>
        <td>{{item.createTime}}</td>
        <td>
          <button class="btn btn-info btn-sm" ui-sref="home.commodity.commodityAdd({commodityId:item.commodityId})">修改</button>
          <button class="btn btn-warning btn-sm" ng-if="item.userId && item.saleStatus==2" ng-click="commodityListCtrl.changeStatus1(item.commodityId)">未审核</button>
          <button class="btn btn-primary btn-sm" ng-click="commodityListCtrl.changeStatus(item.commodityId)">修改推荐状态</button>
          <button class="btn btn-danger btn-sm" ng-click="commodityListCtrl.delete(item.commodityId)">删除</button>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
  <div class="container-fluid">
    <div class="col-md-12">
      <div class="fenyeBox" ng-show="commodityListCtrl.totalNum != 0">
        <div class="pull-left">
          总条数：
          <strong> {{ commodityListCtrl.totalNum}} </strong>条，共
          <strong> {{ commodityListCtrl.pageResult.totalPage}}</strong>
          页，当前第
          <strong>{{ commodityListCtrl.pageNo}}</strong> 页
        </div>
        <div class="pull-right" ng-show="commodityListCtrl.pageResult.totalPage > 1">
          <ul class="pagination">
            <li>
              <button class="btn btn-white btn-bitbucket" ng-disabled=" commodityListCtrl.pageNo==1"
                      ng-click="commodityListCtrl.changePage(1)">
                首页
              </button>
            </li>
            <li>
              <button class="btn btn-white btn-bitbucket" ng-disabled=" commodityListCtrl.pageNo==1"
                      ng-click="commodityListCtrl.changePage(commodityListCtrl.pageNo-1)">
                上一页
              </button>
            </li>
            <li ng-repeat="page in  commodityListCtrl.pageResult.pages">
              <button ng-click="commodityListCtrl.changePage(page)" class="btn btn-white btn-bitbucket"
                      ng-disabled="commodityListCtrl.pageNo == page">{{page}}
              </button>
            </li>
            <li>
              <button class="btn btn-white btn-bitbucket"
                      ng-disabled="commodityListCtrl.pageNo== commodityListCtrl.pageResult.totalPage"
                      ng-click="commodityListCtrl.changePage(commodityListCtrl.pageNo+1)">
                下一页
              </button>
            </li>
            <li>
              <button class="btn btn-white btn-bitbucket"
                      ng-disabled="commodityListCtrl.pageNo== commodityListCtrl.pageResult.totalPage"
                      ng-click="commodityListCtrl.changePage(commodityListCtrl.pageResult.totalPage)">
                尾页
              </button>
            </li>
          </ul>
        </div>
      </div>
      <p class="text-center" ng-hide=" commodityListCtrl.totalNum != 0">查无结果</p>
    </div>
  </div>
</div>
